//
//  WKBlockIconItemCell.m
//  WuKongUsernameLogin
//
//  Created by tt on 2023/9/9.
//

#import "WKBlockIconItemCell.h"

@implementation WKBlockIconItemModel

- (Class)cell {
    return WKBlockIconItemCell.class;
}

- (CGFloat)width {
    if(_width>0) {
        return _width;
    }
    return self.cellHeight;
}

- (CGFloat)cellHeight {
    if(self.height>0) {
        return self.height;
    }
    return super.cellHeight;
}

@end

@interface WKBlockIconItemCell ()

@property(nonatomic,strong) UIImageView *iconImgView;



@end

@implementation WKBlockIconItemCell

+(CGSize) sizeForModel:(WKFormItemModel*)model{
    return CGSizeMake(WKScreenWidth, model.cellHeight);
}


- (void)setupUI {
    [super setupUI];
    self.backgroundColor = [UIColor clearColor];
    self.contentView.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.iconImgView];
    
}

- (void)refresh:(WKBlockIconItemModel *)model {
    [super refresh:model];
    
    self.iconImgView.lim_size = CGSizeMake(model.width, model.height);
    self.iconImgView.image = model.icon;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
   
    self.iconImgView.lim_centerY_parent = self;
    self.iconImgView.lim_centerX_parent = self;
    
}

- (UIImageView *)iconImgView {
    if(!_iconImgView) {
        _iconImgView = [[UIImageView alloc] init];
    }
    return _iconImgView;
}


@end
